package com.scfire.project

import java.util.Date

import org.grails.databinding.BindingFormat

import com.scfire.security.Member

/**
 * Copyright 2015 Shudao Info Tech Co. Ltd.  All rights reserved.
 * @author lhzeng
 * @email zenglh@haoshudao.com
 * @date 2015年6月7日 下午3:29:10
 * @version V1.0
 */

class Praise implements Comparable {
	
	//点赞日期
	@BindingFormat('yyyy-MM-dd HH:mm')
	Date date
	
	//点赞的用户及点赞的项目
	static belongsTo = [member:Member,project:Project]

    static constraints = {
		date nullable:false
		
		project nullable:false
		member nullable:false
    }
	
	public int compareTo(Object o) {
		try{
			date.compareTo(o?.date)
		}catch(Exception e){
			return 1
		}
	}
}
